import { api } from '@/constant'
import * as fileApi from '@/api/file'

// 上传文件
export function uploadFile (context, payload) {
    return new Promise((resolve, reject) => {
        fileApi.uploadFile(payload).then(response => {
            if (response.status === 200) {
                let data = `${api.BASE_API}/file/${response.data}`
                console.log(data)
                resolve(data)
            } else {
                reject(response)
            }
        }).catch(reason => reject(reason))
    })
}
